//
//  helpViewController.m
//  singlebreath
//
//  Created by Eric van Riet Paap on 14-10-08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "helpViewController.h"


@implementation helpViewController



-(id)init {
	self = [super init];
	self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Help" image:[UIImage imageNamed:@"help.png"] tag:0]; 
	return self;
}


// Implement loadView if you want to create a view hierarchy programmatically
- (void)loadView {
	// create and configure the view
	myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; //initilize the view    
	myView.autoresizesSubviews = YES;              //allow it to tweak size of elements in view 
	self.view = myView;
	
	background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TrainingBackground.png"]];
	[self.view addSubview:background];
	
	help = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480 - 20 - 48)]; //XXX remove hardcoding, subtracting statusbar and navbar
	help.backgroundColor = [UIColor clearColor];
	help.alpha = 0.7;
	NSString *imagePath = [[NSBundle mainBundle] resourcePath];
	imagePath = [imagePath stringByReplacingOccurrencesOfString:@"/" withString:@"//"];
	imagePath = [imagePath stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
	[help loadHTMLString:@"<body bgcolor='black' text='white'><b><i>Warning!!!</i></b><br>Freediving is a very dangerous activity that can result in serious injury or even death when performed without a capable and trained buddy! Always train with a buddy!<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><center><a href='help.html'>Now give me some real help!</a><br /><br /><br /><br /><br /><br />(c) 2008 Eric van Riet Paap</center></body>"
						   baseURL:[NSURL URLWithString: [NSString stringWithFormat:@"file:/%@//",imagePath]]];
	[self.view addSubview:help];
	
	/*
	help = [[UILabel alloc] initWithFrame:CGRectMake(0, 18, 320, 480 - 18 - 20)]; //XXX remove hardcoding, subtracting statusbar and navbar
	help.backgroundColor = [UIColor clearColor];
	help.textColor = [UIColor whiteColor];
	help.textAlignment = UIBaselineAdjustmentAlignCenters;
	help.text = @"<b>HELP!</b><br><br>(c) 2008 Eric van Riet Paap";
	[self.view addSubview:help];
	*/
}


/*
 If you need to do additional setup after loading the view, override viewDidLoad.
- (void)viewDidLoad {
}
 */


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
	// Return YES for supported orientations
	return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


- (void)didReceiveMemoryWarning {
	[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
	// Release anything that's not essential, such as cached data
}


- (void)dealloc {
	[super dealloc];
}


@end
